﻿<common:LayoutAwarePage
    x:Name="pageRoot"
    x:Class="Social.Components.Tester.Win8.Views.ImageTools.ImagePresentation"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Social.Components.Tester.Win8.Views.ImageTools"
    xmlns:dc="using:Social.Components.Tester.ViewModel.ImageTools"
    xmlns:common="using:Social.Components.Tester.Win8.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:it="using:ImageTools.Controls"
    xmlns:itFilter="using:ImageTools.Filtering"
    mc:Ignorable="d"
    d:DataContext="dc:ImgPresentationViewModel">

    <Page.Resources>
        <!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
        <x:String x:Key="AppName">Image Presentation</x:String>
        <it:ImageConverter x:Key="ImageConverter"/>
    </Page.Resources>

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid Style="{StaticResource LayoutRootStyle}">
        <Grid.RowDefinitions>
            <RowDefinition Height="112"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <!-- Back button and page title -->
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
            <TextBlock x:Name="pageTitle" Grid.Column="1"  Text="{StaticResource AppName}" Style="{StaticResource PageHeaderTextStyle}" Margin="0,0,-367,40"/>
        </Grid>

        <Grid x:Name="grid2" Grid.Row="1">
            <FlipView x:Name="flipView1" SelectionChanged="FlipView_SelectionChanged" >
                <ScrollViewer ZoomMode="Enabled" MinZoomFactor="0.3">
                    <it:ImageExt Source="{Binding JpgImageSource, Converter={StaticResource ImageConverter}}" Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                </ScrollViewer>
                <ScrollViewer ZoomMode="Enabled" MinZoomFactor="0.3">
                    <it:ImageExt Source="{Binding PngImageSource, Converter={StaticResource ImageConverter}}" Stretch="None"  HorizontalAlignment="Center" VerticalAlignment="Center"/>
                </ScrollViewer>
                <ScrollViewer ZoomMode="Enabled" MinZoomFactor="0.3">
                    <it:ImageExt Source="{Binding GifImageSource, Converter={StaticResource ImageConverter}}" Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                </ScrollViewer>
                <ScrollViewer ZoomMode="Enabled" MinZoomFactor="0.3">
                    <it:ImageExt Source="{Binding OrgImageSource, Converter={StaticResource ImageConverter}}" Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                </ScrollViewer>
            </FlipView>
        </Grid>
        <!--<Border Margin="5" Grid.Row="1" Grid.Column="1">
            <StackPanel>
                <it:ImageExt Source="{Binding JpgImageSource, Converter={StaticResource ImageConverter}}" />
                <TextBlock Text="Jpeg Image Show." />
            </StackPanel>
        </Border>

        <Border Margin="5" Grid.Row="1" Grid.Column="2">
            <StackPanel>
                <TextBlock Text="Bmp Image Show." />
                <it:ImageExt Source="{Binding BmpImageSource, Converter={StaticResource ImageConverter}}" />
            </StackPanel>
        </Border>

        <Border Margin="5" Grid.Row="2" Grid.Column="1">
            <StackPanel>
                <it:ImageExt Source="{Binding PngImageSource, Converter={StaticResource ImageConverter}}" />
                <TextBlock Text="Png Image Show." />
            </StackPanel>
        </Border>

        <Border Margin="5" Grid.Row="2" Grid.Column="2">
            <StackPanel Margin="0,0,185,121">
                <it:ImageExt Source="{Binding GifImageSource, Converter={StaticResource ImageConverter}}" />
                <TextBlock Text="Gif Image Show." />
            </StackPanel>
        </Border>-->
        

        <VisualStateManager.VisualStateGroups>

            <!-- Visual states reflect the application's view state -->
            <VisualStateGroup x:Name="ApplicationViewStates">
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>

                <!-- The entire page respects the narrower 100-pixel margin convention for portrait -->
                <VisualState x:Name="FullScreenPortrait">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <!-- The back button and title have different styles when snapped -->
                <VisualState x:Name="Snapped">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>

    <!--<Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="333*" />
            <ColumnDefinition Width="361*" />
            <ColumnDefinition Width="403*" />
            <ColumnDefinition Width="269*"/>
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="148*" />
            <RowDefinition Height="280*" />
            <RowDefinition Height="340*" />
            <RowDefinition Height="93*"/>
        </Grid.RowDefinitions>


    </Grid>-->
</common:LayoutAwarePage>
